#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll t;cin>>t;while(t--)
#define mod 1000000007
#define inf 1000000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define PI 3.1415926535897932384626433832795l
#define deci(n) cout<<fixed<<setprecision(n);

int main()
{
    fast;
    test
    {
        ll n;
        cin>>n;
        ll a[n];
        map<ll,ll> m;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
        }
        sort(a,a+n);
        if(m[a[0]]>n/2)
        {
            cout<<"Cat\n";
        }
        else
        {
            cout<<"Dog\n";
        }
    }
    return 0;
}
